<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="../../assets/css/layui.css">
		<link rel="stylesheet" type="text/css" href="../../../../css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/add.css"/>
		<style>
			.btn{
				cursor: pointer;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<div class="header">
				<span>删除快递员</span>
			</div>
			<div class="content">
				<table>
					<tr>
						<td class="text-right">手机号码</td><td class="content_right"><input class="input inline-input" id="tel" placeholder="请输入手机号码">
						<button type="button" class="layui-btn layui-btn-blue" id="find" style="cursor: pointer;">立即查找</button></td>
					</tr>
				</table>
			</div>


			<div class="header">
				<span>查找信息如下</span>
			</div>
			<div class="content">
				<table>
					<tr>
						<td class="text-right">姓名</td><td class="content_right"><input readonly class="input" placeholder="请输入姓名" id="realName"></td>
					</tr>
					<tr>
						<td class="text-right">手机号码</td><td class="content_right"><input readonly class="input" placeholder="请输入手机号码" id="tel1"></td>
					</tr>
					<tr>
						<td class="text-right">身份证号码</td><td class="content_right"><input readonly class="input" placeholder="请输入身份证号码" id="identityId"></td>
					</tr>
					<tr>
						<td></td><td class="content_right"><button type="button" class="layui-btn layui-btn-blue" id="delete">立即删除</button>  </td>
					</tr>
				</table>
			</div>
		</div>
	</body>
	<script src="../../../qrcode/jquery2.1.4.js"></script>
	<script src="../../../layer/layer.js"></script>
	<script src="../../../js/request.js"></script>
	<script>
		$(function(){
			$(".header:eq(1),.content:eq(1)").hide();
			$("#find").click(function(){
				if($("#tel").val() === ""){
					layer.msg("请填写手机号");
					$(".header:eq(1),.content:eq(1)").hide();
					return;
				}else{
					var windowId = layer.load(2);
					$.post(
							"/courier/hasUser.do",
							{tel:$("#tel").val()},
							function(res){
								layer.close(windowId);
								if(res.status === 1){
									layer.msg('查询成功');
									$(".header:eq(1),.content:eq(1)").show();
									$("#realName").val(res.data.name);
									$("#tel1").val(res.data.sysPhone);
									$("#identityId").val(res.data.idCardNumber);
									sessionStorage.setItem("userId",res.data.id);
								}else if(res.status===-1){
									layer.msg("用户未登录");
								}else{
									layer.msg('此手机号还未绑定账号，查询失败');
									$(".header:eq(1),.content:eq(1)").hide();
								}

							},"json"
					);
				}
			});
			$("#delete").click(function(){
				let windowId = layer.load(2);
				$.post("/courier/delete.do",{
					tel:$("#tel").val()
				},function(data){
					layer.close(windowId);
					if(data==='success'){
						layer.msg("管理员删除成功");
					}else if(data==='false'){
						layer.msg("管理员删除失败")
					}
				},"text");
			});

		});
	</script>
</html>
